/*************************************************************************
	> File Name: client.cpp
	> Author: ma6174
	> Mail: ma6174@163.com 
	> Created Time: 2021年12月02日 星期四 21时16分04秒
 ************************************************************************/

#include<iostream>
#include "composite.h"
using namespace std;

int main()
{
	Component* root = new Composite("root");
	root->add(new Leaf("Leaf A"));
	root->add(new Leaf("Leaf B"));

	Component* comp = new Composite("Composite X");
	comp->add(new Leaf("Leaf XA"));
	comp->add(new Leaf("Leaf XB"));

	root->add(comp);

	Component* comp2 = new Composite("Composite XY");
	comp2->add(new Leaf("Leaf XYA"));
	comp2->add(new Leaf("Leaf XYB"));

	comp->add(comp2);

	root->add(new Leaf("Leaf C"));

	Component* leaf = new Leaf("Leaf D");
	root->add(leaf);
	root->remove(leaf);

	root->display(1);

	return 0;
}
